package com.magicsoft.app.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.boyuan.huijiaoyu.R;

public class SelectorDialogAdapter extends CTHAdapter<String> {

	public SelectorDialogAdapter(Context context, List<String> data) {
		super(context, data);

	}

	@Override
	public int getCount() {

		return data.size();
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		HolderViewStatic viewContent = new HolderViewStatic();

		String string = data.get(position);

		if (convertView == null) {

			convertView = mInflater.inflate(R.layout.selector_dialog_list_item,
					null);

			viewContent.textView = (TextView) convertView
					.findViewById(R.id.textview);

			convertView.setTag(viewContent);

		} else {
			viewContent = (HolderViewStatic) convertView.getTag();
		}

		if (position == 2) {
			viewContent.textView.setTextColor(context.getResources().getColor(
					R.color.home_tab_bg));
		} else {
			viewContent.textView.setTextColor(context.getResources().getColor(
					R.color.form_edit));
		}
		viewContent.textView.setText(string);

		return convertView;

	}

	static class HolderViewStatic {
		TextView textView;
	}
}
